import { createRouter, createWebHistory } from 'vue-router'
import LoginRegister from '@/views/login/LoginRegister.vue'
import ForgotPassword from '@/views/login/ForgotPassword.vue'
import MainLayout from '@/index.vue'
import ManageIndex from '@/views/manage/index.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'Login',
      component: LoginRegister
    },
    {
      path: '/login',
      name: 'LoginPage',
      component: LoginRegister
    },
    {
      path: '/forgot-password',
      name: 'ForgotPassword',
      component: ForgotPassword
    },
    {
      path: '/main',
      name: 'MainLayout',
      component: MainLayout,
      children: [
        {
          path: 'manage',
          name: 'Manage',
          component: ManageIndex
        }
      ]
    },
    {
      path: '/manage',
      name: 'DirectManage',
      component: MainLayout
    },
    {
      path: '/:catchAll(.*)',
      name: '404',
      component: () => import('../views/login/404.vue')
    },
  ]
})

export default router
